//
//  CapTrueVCPushPage.m
//  PetAPP
//
//  Created by apple on 16/3/3.
//  Copyright © 2016年 Yuming. All rights reserved.
//

#import "CapTrueVCPushPage.h"

@interface CapTrueVCPushPage () <UIWebViewDelegate>

@property (nonatomic, retain) UIWebView *webView;

@end

@implementation CapTrueVCPushPage

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    [self createWebView];
}

- (void)createWebView {
    
    self.webView = [[UIWebView alloc] initWithFrame:self.view.frame];
    [self.view addSubview:_webView];
    [_webView release];
    self.webView.dataDetectorTypes = UIDataDetectorTypeAll;
    self.webView.userInteractionEnabled = YES;
    self.webView.backgroundColor = [UIColor whiteColor];
    self.webView.opaque = NO;/**< 不透明 */
    self.webView.delegate = self;
    
    NSURL *url = [NSURL URLWithString:self.webUrl];
    
    [self.webView loadRequest:[NSURLRequest requestWithURL:url]];
    
}

- (void)webViewDidFinishLoad:(UIWebView *)webView {
    /** 贝塞尔曲线设置毛玻璃 */
    UIBezierPath *backgroundPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 3, 40, 40) cornerRadius:20];
    
    UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
    leftButton.frame = CGRectMake(10, 40, 40, 40);
    leftButton.imageEdgeInsets = UIEdgeInsetsMake(10, 10, 10, 10);
    [leftButton addTarget:self action:@selector(handleBackButton) forControlEvents:UIControlEventTouchUpInside];
    [leftButton setImage:[UIImage imageNamed:@"backForCap"] forState:UIControlStateNormal];
    [self.view addSubview:leftButton];
    
    leftButton.layer.shadowPath = backgroundPath.CGPath;
    leftButton.layer.shadowOpacity = 0.4;
    leftButton.layer.shadowRadius = 0;
    leftButton.layer.shadowColor = [UIColor blackColor].CGColor;

}

/** 退后按钮 */
- (void)handleBackButton {
    [self.navigationController popViewControllerAnimated:YES];
    
    
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
